<?php
namespace app\admin\controller;
use think\Controller;
use app\admin\model\Cate;
use think\Model;
use think\View;
use think\Request;
use think\Session;
use app\admin\controller\Base;
class Promotion extends Base
{
    public function addredbag_type()
    {
        return $this->fetch();
    }

    public function Redbag_type()	
    {
    	$cate=new Cate();
    	$res=$cate->redbao();
        return $this->fetch('redbag_type',['info'=>$res]);
    }
    public function red_del()
    {
    	$id=Request::instance()->param("red_id");
    	$user=model("Cate");
    	$res=$user->red_del($id);
    	if ($res) {
    		echo "<script>alert('移除成功');location.href='redbag_type'</script>";
    	}else{
    		echo "<script>alert('移除失败');location.href='redbag_type'</script>";
    	}
    }
    public function red_add()
    {
    	$post=Request::instance()->param();
    	$usere=model("Cate");
    	$res=$usere->addss($post);
    	if ($res) {
            echo "<script>alert('添加成功');location.href='Redbag_type'</script>";
        }else{
            echo "<script>alert('添加失败');location.href='addredbag_type'</script>";
        }
    }
} 